

import java.util.LinkedList;
import java.util.Scanner;
public class lsl {

    @SuppressWarnings("deprecation")
    public static void main(String args[]) {

        LinkedList<Integer> list = new LinkedList<Integer>();
        System.out.println("\t\t\t\t整型数据管理系统");

        System.out.println("添加1   删除2   查询3  修改4  退出0");

        Scanner reader=new Scanner(System.in);
        while(!reader.hasNext("0")) {
            int n=reader.nextInt();
            if(n==1) {
                System.out.println("请输入5个元素");
                for(int i=0;i<5;i++) {
                    int num1=reader.nextInt();
                    System.out.print(num1+" ");
                    list.add(num1);

                }
                System.out.print("当前数据为：");
                System.out.println(list);
                System.out.println("添加1   删除2   查询3  修改4  退出0");
                continue;
            }

            else
            if(n==2) {
                System.out.println("   ");
                System.out.println("删除元素：");
                Integer num2=reader.nextInt();
                list.remove(num2);

                System.out.print("当前数据为：");
                System.out.println(list);
                System.out.println("添加1   删除2   查询3  修改4  退出0");
                continue;
            }
            else
            if(n==3) {
                System.out.println("请输入要查找的元素");
                int number=reader.nextInt();
                if(list.contains(number))
                {
                    System.out.println("找到："+number);
                }
                else {System.out.println("无");}
                System.out.println("添加1   删除2   查询3  修改4  退出0");
                continue;
            }
            else
            if(n==4) {
                System.out.println("请输入要修改的元素位置");
                int number1=reader.nextInt();
                System.out.println("请输入要修改值：");
                int number2=reader.nextInt();
                list.set(number1, number2);
                System.out.println("已修改后:");
                System.out.println(list);
                System.out.println("添加1   删除2   查询3  修改4  退出0");
                continue;
            }


        }









    }
}